<?php

namespace App\Admin\Controllers\Agent;

use App\Models\AgentRechargeRecord;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use Illuminate\Support\Facades\Auth;

class BalanceController extends AdminController
{
    /**
     * Title for current resource.
     *
     * @var string
     */
    protected $title = '余额变动记录';

    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        $grid = new Grid(new AgentRechargeRecord());

        $grid->model()->where('admin_user_id',Auth::guard()->id())->orderByDesc('id');

        $grid->column('id', __('Id'));
        $grid->column('adminUser.name', __('用户'));

        $grid->column('amount', __('金额'));
        $grid->column('balance', __('变化后余额'));
        $grid->column('remark', __('备注'));
        $grid->column('operator', __('操作者'));
        $grid->column('created_at', __('时间'));

        $grid->disableActions();
        $grid->disableCreateButton();

        return $grid;
    }

}
